<template>
  <div class="container">
    <img :src="evaluationInfo.pic" class='pic'/>
    <div style="margin-left: 24px;margin-right: 24px;">

      <div class="userBlock">
        <img class="avatar" src="/web-hft-ee/static/img/common_profile.png" v-real-img="bean.userPic"/>
        <span class="nickname">{{bean.userNickname}}</span>
      </div>

      <p class="section"><span class="sectionBlock"/>{{evaluationInfo.title}}结果</p>
      <div v-for="result in results">
        <p class="resultTitle" v-if="result.title">{{result.title}}</p>
        <p class="resultRemark" v-if="result.remark">{{result.remark}}</p>
      </div>
    </div>
  </div>
</template>

<script>
  import EvaluationAPI from "../../repo/api/EvaluationAPI";
  import store from "../../repo/store/store";

  export default {
    name: "evaluation-report",
    data() {
      return {
        bean: {},
        targetUserId: this.$route.query.targetUserId || 0,
      }
    },
    computed: {
      param() {
        return this.$route.params;
      },
      evaluationId() {
        return this.param.evaluationId;
      },
      resultId() {
        let resultId = this.param.resultId;
        return resultId === '0' ? undefined : resultId;
      },
      evaluationInfo() {
        return this.bean.evaluateInfo || {};
      },
      results() {
        return this.bean.evaluateResult || [];
      }

    },
    created() {
      let userId = 0
      if (this.targetUserId != 0) {
        userId = this.targetUserId
      } else {
        userId = store.getters.userid;
      }
      EvaluationAPI.getMyEvaluateResultDetailById(userId, this.evaluationId, this.resultId)
        .then((result) => {
          this.bean = result.responseData
        })
    },
    methods: {},
  }
</script>

<style scoped>
  .container {
    box-shadow: 0 0 10px #CCCCCC;
    display: flex;
    flex-direction: column;
    border-radius: 4px;
    margin: 48px 24px;
    padding-bottom: 24px;
    width: calc(100% - 48px);
  }

  .pic {
    object-fit: cover;
    width: 100%;
    border-radius: 4px 4px 0 0;
    clip-path: polygon(0% 80%, 100% 100%, 100% 0%, 0% 0%);
  }


  .avatar {
    height: 32px;
    width: 32px;
    border-radius: 16px;
  }

  .nickname {
    margin-left: 4px;
    margin-right: 24px;
  }

  .section {
    color: #1DA1F2;
    font-weight: bold;
    font-size: 14px;
    margin-top: 24px;
  }

  .sectionBlock {
    height: 14px;
    width: 4px;
    background-color: #1DA1F2;
  }

  .resultTitle {
    font-size: 20px;
    color: #323334;
    margin-top: 16px;
  }

  .resultRemark {
    font-size: 14px;
    color: #646668;
    margin-top: 16px;
  }

  .userBlock {
    display: flex;
    flex-direction: row;
    align-items: center;
  }
</style>
